package com.talkyun.openx.validator.impl;

import com.talkyun.openx.validator.annotation.ObjectValidator;

import java.lang.annotation.Annotation;

public class ObjectValidatorImpl extends AbstractValidator {

    @Override
    public String validate(Annotation ann, String argName, Object argVal) {
        return doValidate((ObjectValidator) ann, argName, (String) argVal);
    }

    private String doValidate(ObjectValidator sv, String name, String val) {
        if (sv.notNull() && val == null) {
            return "参数不能为空!";
        }
        return null;
    }
}